import { createAction } from 'redux-actions';
import * as types from '../constants/ActionTypes';
import * as Api from '../utils/WebAPIUtils.js';
import Tool from '../utils/ToolUtils.js';

const getOfficialPackageAction = createAction(types.FETCH_OFFICIAL_PACKAGE, data => data);

exports.fetchPackageList = (data) => (dispath) =>
  Tool.post(Api.officialPackage.query, data, (res) => {
    dispath(getOfficialPackageAction(res));
  });
